# Time Limit Exceeded

nums = input()
flag = 0
inputs = []
phones = []
while flag < int(nums):
    inputs.append(input())
    flag = flag + 1

# inputs = ["4873279", "ITS-EASY", "888-4567",
#           "3-10-10-10", "888-GLOP", "TUT-GLOP",
#           "967-11-11", "310-GINO", "F101010",
#           "888-1200", "-4-8-7-3-2-7-9-", "487-3279"]

for r in inputs:
    if "-" in r:
        r = r.replace("-", "")

    phone = ""
    for h in r:
        if h == "A" or h == "B" or h == "C":
            phone = phone + "2"
        elif h == "D" or h == "E" or h == "F":
            phone = phone + "3"
        elif h == "G" or h == "H" or h == "I":
            phone = phone + "4"
        elif h == "J" or h == "K" or h == "L":
            phone = phone + "5"
        elif h == "M" or h == "N" or h == "O":
            phone = phone + "6"
        elif h == "P" or h == "R" or h == "S":
            phone = phone + "7"
        elif h == "T" or h == "U" or h == "V":
            phone = phone + "8"
        elif h == "W" or h == "Y" or h == "X":
            phone = phone + "9"
        else:
            phone = phone + h
    phoneList = list(phone)
    phoneList.insert(3, "-")
    phone = "".join(phoneList)
    phones.append(phone)

phones.sort(reverse=False)
outPutSet = set()
output = []
for m in phones:
    count = phones.count(m)
    if count >= 2:
        outPutSet.add(m)

if len(outPutSet) == 0:
    print("No duplicates.")
else:
    output = list(outPutSet)
    for i in output:
        print(i + " " + str(phones.count(str(i))))
